import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useCounterStore = defineStore('counter', () => {
    //定义我的订单
    const myorderList = ref([])
    //定义订单中的数据
    function AddmyOrder(arr){
        myorderList.value=arr.map(item=>{
            return({
                id:new Date().getTime()+Math.random(),
                title:'No'+new Date().getTime()+Math.random(),
                status:Math.floor(Math.random()*2)+1,
                price:item.price,
                orderList:[item]
            })
        })
    }
    return { myorderList, AddmyOrder }
}, {
    persist: true,
})